import type React from 'react'
import './index.scss'
import classNames from 'classnames'

type propsT = {
    type: string,
    onClick?: Function,
    name?: string,
    children?: React.ReactNode,
    disabled?: boolean,
    width?:  string | number,
    height?: string | number,
}

function MyButton(props:propsT){
    function handleClick(){
        props.onClick && props.onClick()
    }
    return (
        <button 
            className={classNames('btn',{ 'guest':props.type==='guest'},{'danger':props.type==='danger'})}
            style={{ width: props.width, height: props.height }}
            onClick={()=>handleClick()}
            type='button'
            disabled={props.disabled}
        >
            {props.children}
            <span>{props.name}</span>
        </button>
    )
}

export default MyButton